package com.community.common.controller;


import com.community.common.pojo.PageRequest;
import com.community.common.pojo.dto.HouseBatchDto;
import com.community.common.pojo.dto.HousePageQueryDto;
import com.community.common.pojo.response.LayuiPage;
import com.community.common.pojo.response.MyResponse;
import com.community.common.service.HouseService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * <p>
 * 楼栋表 前端控制器
 * </p>
 *
 * @author superman
 * @since 2020-08-02
 */
@Controller
@RequestMapping("/house")
public class HouseController {

    @Resource
    HouseService houseService;

    @ResponseBody
    @PostMapping("/batchAdd")
    public MyResponse batchAdd(HouseBatchDto batchDto) {
        houseService.batchAdd(batchDto);
        return MyResponse.success();
    }


    @ResponseBody
    @PostMapping("/pageQuery")
    public LayuiPage queryByPage(@RequestBody PageRequest<HousePageQueryDto> pageQueryDto) {
        return LayuiPage.parsePage(houseService.pageQuery(pageQueryDto));
    }

}
